package net.iceflow.dunsel.client.command;

import net.iceflow.dunsel.client.CommandType;
import net.iceflow.dunsel.client.CommandableFacade;
import net.iceflow.dunsel.commons.commandqueue.Command;
import net.iceflow.dunsel.commons.commandqueue.CommandQueueContext;

/**
 *
 */
public class ConnectCommand implements Command<CommandQueueContext<CommandableFacade>> {

    @Override
    public void execute(CommandQueueContext<CommandableFacade> context) {

        System.out.println("Running connect command!");

        context.getModel().notifySuccesfullConnection();

        context.getModel().injectCommand(CommandType.DISCONNECT);
        context.getModel().injectCommand(CommandType.DISCONNECT);
        context.getModel().injectCommand(CommandType.DISCONNECT);

        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            // Intentionally do nothing
        }

        System.out.println("Doing more stuff!");

        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            // Intentionally do nothing
        }

        System.out.println("Doing even more stuff!");

    }
}
